/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#pragma once

#include <baja/common.hpp>

namespace baja { namespace transition_tracking {

struct itransition_parameters : public baja::ibase
{
    BAJA_INTERFACE(itransition_parameters, "5B353B90-BEF4-4CB2-9D1F-447DE515FE7C")

    virtual void dump() = 0;
    virtual baja::uint32 transitionType() = 0;
};

struct transition_path_node
{
    baja::uint32 typeToken;
    baja::uint32 id;
};

struct itransition_target : public baja::ibase
{
    BAJA_INTERFACE(itransition_target, "CFE45DE1-4C06-4E4A-9687-7B3D868F57B7")

    virtual void buildTransitionPath(
        std::vector<transition_path_node>& path
        ) = 0;

    virtual const std::vector<transition_path_node>& transitionPath() = 0;

    virtual void undo(
        const std::vector<transition_path_node>& path,
        const baja::uint32& index,
        const std::shared_ptr<itransition_parameters>& transitionParameters
        ) = 0;

    virtual void redo(
        const std::vector<transition_path_node>& path,
        const baja::uint32& index,
        const std::shared_ptr<itransition_parameters>& transitionParameters
        ) = 0;
};

struct itransitions_bundle : public baja::ibase
{
    BAJA_INTERFACE(itransitions_bundle, "4AAB552A-F2E8-4892-BC63-F8BE8DBFC850")

    virtual void addTransition(
        const std::vector<transition_path_node>& absolutePath,
        const std::shared_ptr<itransition_parameters>& transitionParameters
        ) = 0;
};

struct itransition_tracking_service : public baja::ibase
{
    BAJA_INTERFACE(itransition_tracking_service, "CD01F280-CEF2-4C62-B46A-20CFDE7527AF")

    virtual void initialize() = 0;

    virtual void registerRootTransitionTarget(
        std::shared_ptr<itransition_target> rootTarget
        ) = 0;

    virtual baja::uint32 generateTargetTypeToken() = 0;

    virtual void addTransitionsBundle(
        const std::shared_ptr<itransitions_bundle>& transitionBundle
        ) = 0;

    virtual void startTransitionBundle() = 0;
    virtual void endTransitionBundle() = 0;

    virtual void addTransition(
        const std::vector<transition_path_node>& absolutePath,
        const std::shared_ptr<itransition_parameters>& transitionParameters
        ) = 0;

    virtual void undo() = 0;
    virtual void redo() = 0;
};

}} // baja::transition_tracking